<!DOCTYPE html>
<html>
<head>
<?php include_once VIEWS.'inc/head.php'; ?>
	<style>
		.main-textarea.half{
			height: 164px;
		}
	</style>
</head>
<body>
    <?php include_once VIEWS.'inc/header.php'; ?>
    <div class="main">
    	<div class="w980">
    		<div class="main-tit f-cb">
    			<a href="javascript:;" class="data cur">企业资料</a>
    			<a href="<?php echo site_url('article')?>" class="art">发布长文章</a>
    		</div>
            <?php echo form_open('information/add', array("enctype" => "multipart/form-data", "class" => "form-horizontal")); ?>
    		<div class="main-content">
				<div class="main-line bb f-cb">
					<p class="main-p">公司全称:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $company['name']?></p>
					<p class="main-p">公司简称:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $company['short']?> </p>
				</div>
				<!-- 图片上传 -->
				<div class="main-line bb f-cb">
                    <div class="control-group">
                        <label for="img" class="control-label main-title"><?php echo lang('photo') ?>LOGO：</label>
                        <div id="js-photo-show" class="js-img-list-f fl" style="margin-right: 20px"></div>
                        <div class="controls fl">
                            <div class="btn-group upload-btn">
                            上传图片
                                <span class="btn btn-success">
                                    <i class="fa fa-upload"></i>
                                    <span> <?php echo lang('upload_file') ?> </span>
                                    <input class="fileupload upload-input" type="file" accept="" multiple>
                                </span>
                                <input type="hidden" name="photo" class="form-upload" data-more="0" value="<?php echo $company["photo"] ?>">
                                <input type="hidden" name="thumb" class="form-upload-thumb" value="<?php echo $company["thumb"] ?>">
                            </div>
                            <div class="upload-tips">1、像素要求：100*100以上 <br>2、点击上传（仅限1M以内.jpg  .png 格式） </div>
                        </div>
                    </div>
				    <div class="clear"></div>
				</div>

				<div class="main-line bb f-cb">
					<div class="main-title">股票代码:</div>
					<input type="text" class="main-input" name="stock_code" id="stock_code" value="<?php echo $company['stock_code'] ? $company['stock_code'] : ''?>" <?php echo $company['stock_code'] ? 'disabled' : ''?>>
				</div>

				<div class="main-line bb f-cb">
					<div class="main-title">所在行业:</div>
					<div class="industry-list fl">
						<ul>
							<?php foreach($industry as $row) {?>
								<li class="<?php echo $row['is_select'] ? 'cur' : '' ?>" data-id="<?php echo $row['id']?>"><?php echo $row['title']?></li>
							<?php }?>
						</ul>
						<input type="hidden" name="industry" id="industry" value="<?php echo $company['industry'] ? $company['industry'] : '' ?>" />
					</div>
				</div>
				<div class="main-line bb f-cb">
					<div class="main-title">企业联系人:</div>
					<ul class="leader-list fl">
						<li class="f-cb">
							<span class="fl name"><?php echo $userinfo['uname']?> <?php echo $userinfo['position']?></span>
							<span class="fl id  cur " data-id="<?php echo $userinfo['id']?>">企业代表</span>
						</li>
						<?php foreach($accounts as $key => $val) {?>
							<li class="f-cb">
								<span class="fl name"><?php echo $val['uname']?> <?php echo $val['position']?></span>
								<span class="fl id " data-id="<?php echo $val['id']?>">转让企业代表</span>
							</li>
						<?php }?>
					</ul>
					<input type="hidden" name="transfer" id="transfer" value="<?php echo $userinfo['id'] ? $userinfo['id'] : '' ?>" />
				</div>
				<div class="main-line bb f-cb">
					<div class="main-title">一句话介绍:</div>
					<input type="text" class="main-input" name="short_desc" id="short_desc" value="<?php echo $company['short_desc'] ? $company['short_desc'] : '' ?>">
				</div>
				<div class="main-line bb f-cb">
					<div class="main-title">企业简介:</div>
					<textarea class="main-textarea half" name="desc" id="desc"><?php echo $company['desc'] ? $company['desc'] : '' ?></textarea>
				</div>
				<div class="main-line bb f-cb">
					<div class="main-title">市场分析:</div>
					<textarea class="main-textarea half" name="fund" id="fund"><?php echo $company['fund'] ? $company['fund'] : '' ?></textarea>
				</div>
				<div class="main-line bb f-cb">
					<div class="main-title">核心优势:</div>
					<textarea class="main-textarea half" name="pdesc" id="pdesc"><?php echo $company['pdesc'] ? $company['pdesc'] : '' ?></textarea>
				</div>
				<div class="main-line bb f-cb">
					<div class="main-title">经营业绩:</div>
					<textarea class="main-textarea half" name="operation" id="operation"><?php echo $company['operation'] ? $company['operation'] : '' ?></textarea>
				</div>
				<div class="main-line bb f-cb">
					<div class="main-title">融资历程:</div>
					<textarea class="main-textarea half" name="team" id="team"><?php echo $company['team'] ? $company['team'] : '' ?></textarea>
				</div>
                <!-- 图片上传 -->
                <div class="main-line bb f-cb">
                    <div class="control-group">
                        <label for="img" class="control-label main-title"><?php echo lang('photo') ?>商业计划书：</label>
                        <div id="js-plan-show" class="js-img-list-f fl" style="margin-right: 20px"></div>
                        <div class="controls fl">
                            <div class="btn-group upload-btn">
                                选择文件

                                <span class="btn btn-success">
                                    <i class="fa fa-upload"></i>
                                    <span> <?php echo lang('upload_file') ?> </span>
                                    <input class="fileupload upload-input" type="file" accept="" multiple>
                                </span>
                                <input type="hidden" name="plan" class="form-upload" data-more="0" value="<?php echo $company["plan"] ?>">
                            </div>

                            <?php if($company['plan']) {?>
                                <div class="check-file">
									<!--<a href="<?php /*echo $company['plan'] ? site_url('information/download') : '##' ; */?>">查看文件</a>-->
									<a href="<?php echo $company['plan'] ? UPLOAD_URL.$com_plan['url']: '##' ; ?>" target="_blank">查看文件</a>
								</div>
                            <?php }?>
							<br/>请上传PDF格式的文件
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>
				<div class="main-line bb f-cb">
					<div class="information-tips <?php echo  $company['is_combing'] ? 'cur' : ''?>" >请企融直通车帮助优化展示公司的商业价值</div>
				</div>
				<div class="main-line f-cb">
                    <input type="hidden" name="id" value="<?php echo $company['id']?>" />
                    <input type="hidden" name="is_combing" id="is_combing" value="<?php echo $company['is_combing']?>" />
					<input type="submit" name="" value="保存" class="main-sub">
				</div>
    		</div>
            <?php echo form_close()?>
    	</div>
    </div>

<?php
	echo static_file('web/js/main.js');
	echo static_file('jquery.form.min.js');
?>
<?php

echo static_file('require.js');
echo static_file('require.config.js');

?>
<div style=" display: none;">
	<?php include_once VIEWS.'inc/inc_ui_media_head.php'; ?>
</div>

<script type="text/javascript">
	require(['adminer/js/ui','web/js/media'],function(ui,media){
		media.init();
		var photo_sign = <?php echo json_encode(one_upload($company["photo"])) ?>;
		if(photo_sign.url) {
			media.show(photo_sign,"photo");
		}

        var plan = <?php echo json_encode(one_upload($company["plan"])) ?>;
		if(plan.url) {
			media.show(plan,"plan");
		}

	});
</script>
<script>
$(function(){
	$('.main-choosebox a').on('click',function(){
		$(this).addClass('cur').siblings().removeClass('cur');
	});
	var id = '';
	$('.industry-list li').each(function($k,$v){
		if($(this).hasClass("cur")) {
			id += $(this).attr('data-id')+',';
		}
	});
	$('#industry').val(id.substring(0,id.length-1));
	$('.industry-list li').on('click',function(){  //所在行业
		$(this).toggleClass('cur');
		$(this).each(function(){
			if($(this).hasClass("cur")) {
				id += $(this).attr('data-id')+',';
			}
		});
		var ids = id.substring(0,id.length-1);
		$('#industry').val(ids);
	});



	$('.leader-list .id').on('click',function(){   //转让企业代表
		$(this).addClass('cur').parents('li').siblings().find('.id').removeClass('cur');
		$('#transfer').val($(this).attr('data-id'));
	});

	//点亮图标
	$('.information-tips').on('click',function(){
		<?php if($company['is_combing'] && !$company['status']) {?>
		alert('您的申请已受理，客服将尽快与您联系');
		return false;
		<?php }?>
		if(confirm('是否确认请企融直通车帮助展示公司商业价值')) {
			var url = '<?php echo site_url('information/combing') ?>';
			var id = '<?php echo $company['id']?>';
			$.ajax({
				url:url,
				type:'post',
				dataType:'json',
				data:{id:id,_scfs: $.cookie('_scfc')}
			}).done(function(data){
				if(data.status == 1) {
					$('.information-tips').toggleClass('cur');
					if($('.information-tips').hasClass('cur')) {
						$('#is_combing').val(1);
					}else {
						$('#is_combing').val(0);
					}
				} else {

				}
				alert(data.msg);
			});

		}

	})
	$('.upload-close').click(function() {
		var url = '<?php echo site_url('information/delLogo') ?>';
		$.ajax({
			url:url,
			type:'post',
			dataType:'json',
			data:{_scfs: $.cookie('_scfc')}
		}).done(function(data){
			if(data.status == 1) {
				$('#logo').attr('src','');
			} else {
				var i=0;
				$.each(data.msg,function(putid,putv){
					i++;
					if(i==1){ alert(putv); }
				});
			}
		})
	});
})
</script>
<script>
	$("#frm-logo").delegate('input[name="photo"]', 'change', function(event) {
		event.preventDefault();
		files_o=$(this).val().split(".");
		k=files_o[files_o.length-1].toLocaleLowerCase();
		if(k!="jpg" && k!="gif" && k!="jpeg" && k!="png" && k!="bmp"){
			alert("上传图片格式： JPG, GIF, JPEG, PNG, BMP!");
			return false;
		}
		// 提交表单
		$('#frm-logo').ajaxSubmit(avatar_opts);

		return false;
	});

	avatar_opts = {
		success:function(data){
			if (data.status==1) {
				$('#logo').attr('src',data.url);
			} else if(data.status==2){
				alert(data.error);
			} else {
				alert(data.msg);
			}
		}
	};
</script>
<script>
	$("#frm-plan").delegate('input[name="plan"]', 'change', function(event) {
		event.preventDefault();
		files_o=$(this).val().split(".");
		k=files_o[files_o.length-1].toLocaleLowerCase();
		if(k!="pdf" && k!="ppt" && k!="word" && k!="zip" && k!="rar"){
			alert("上传图片格式： JPG, GIF, JPEG, PNG, BMP!");
			return false;
		}
		// 提交表单
		$('#frm-plan').ajaxSubmit(avatar_opts);

		return false;
	});

	avatar_opts = {
		success:function(data){
			if (data.status==1) {
				$('#plan').attr('src',data.url);
			} else if(data.status==2){
				alert(data.error);
			} else {
				alert(data.msg);
			}
		}
	};
</script>
</body>
</html>